/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.feedback.base;

import cn.hutool.core.util.RandomUtil;
import info.peigen.hotpot.common.service.base.test.ServiceTestBase;
import info.peigen.hotpot.common.service.base.test.mock.ServiceTestMockContextThreadLocal;
import info.peigen.hotpot.component.feedback.FeedbackApplication;
import info.peigen.hotpot.component.feedback.config.FeedbackProperties;
import info.peigen.hotpot.component.feedback.domain.Feedback;
import info.peigen.hotpot.component.feedback.service.order.FeedbackOrder;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.extension.ExtendWith;
import org.noear.solon.annotation.Inject;
import org.noear.solon.test.SolonJUnit5Extension;
import org.noear.solon.test.SolonTest;

/**
 * <b>(FeedbackTestBase)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/11/17
 */
@Slf4j
@SolonTest(FeedbackApplication.class)
@ExtendWith(SolonJUnit5Extension.class)
@FieldDefaults(level = AccessLevel.PROTECTED)
public class FeedbackTestBase extends ServiceTestBase implements FeedbackTestBaseMockConstant {
    @Inject
    protected FeedbackProperties feedbackProperties;

    ServiceTestMockContextThreadLocal mockContext = new ServiceTestMockContextThreadLocal();

    protected FeedbackOrder genFeedbackOrder() {
        return FeedbackOrder.builder()
                .context(CONTEXT)
                .images(IMAGES)
                .partnerId(SELF_PARTNER_ID)
                .bizOrderNo(RandomUtil.randomString(20))
                .build();
    }

    protected Feedback genFeedback() {
        return Feedback.builder()
                .customerId(CUSTOMER_ID)
                .context(CONTEXT)
                .images(IMAGES)
                .partnerId(SELF_PARTNER_ID)
                .build();
    }
}